<?xml version="1.0" encoding="UTF-8" ?>
<!--

    ﻿Copyright (C) 2009-2013 NewMain Softech

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
    either express or implied. See the License for the specific language
    governing permissions and limitations under the License.

-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>LoggerWrap</title>
</head>
<body>
<h3>LoggerWrap</h3>
<p><h4>Introduction</h4>
LoggerWrap is the framework for GWT client-side code and server-side code to enable dynamically 
switching logger framework/configuration via the next features: 
<ul>
	<li>Wrapper interface of logger</li>
	<li>Injection mechanism of logger</li>
</ul>
For the client side, it can also provide the uniformed log coding style even for the inside of JSNI 
method for different browsers. <br />
Thereby, it allows to keep the integrity of the usage style of logger among GWT client-side code 
and server-side code even for different configurations.<br />
<br />
LoggerWrap framework may suit you when you like:
<ul>
	<li>To have the identical logging style for between client side (GWT) and server side.</li>
	<li>To make your code capable to support other logging framework than JUL 
	(<code>java.util.logging</code>) package.
	</li>
	<li>To have ability of dynamically switching between different logging 
	configuration/implementation/frameworks.
	</li>
	<li>To have uniformed log coding style at the inside of JSNI method.
	</li>
</ul>
</p>
<p><h4>Usage guide</h4>
<ul>
	<li><b>Logger consumer side</b> - To obtain <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrap.html"
		><code>LoggerWrap</code></a> instance<br />
		<ul>
			<li>If your <b>class does not have static method to be logged</b>, then you <b>may extend 
				your class from <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrapAdapterTemplate.html"
				><code>LoggerWrapAdapterTemplate</code></a> abstract class</b>.
				<ol>
					<li>Override <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrapAdapterTemplate.html#getNameForLogging%28%29"
						><code>LoggerWrapAdapterTemplate.getNameForLogging()</code></a> abstract method to 
						return the name of your logger.
					</li>
					<li>Get <code>LoggerWrap</code> instance via <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrapAdapterTemplate.html#getLoggerWrap()"
						><code>LoggerWrapAdapterTemplate.getLoggerWrap()</code></a> method, and use it to 
						record log in your method.
					</li>
				</ol>
			</li>
			<li>When your <b>class has static method to be logged or cannot be extended from
				<code>LoggerWrapAdapterTemplate</code> abstract class</b>.<br />
				Use either one of following getter method for <code>LoggerWrap</code> instance:
				<ul>
					<li>Overloaded static getLoggerWrap methods of <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrapFactoryImpl.html"
						><code>LoggerWrapFactoryImpl</code></a> class
					</li>
					<li><a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrapFactoryImpl.html#getLoggerWrap(java.lang.String)"
						><code>LoggerWrapFactoryImpl.getLoggerWrap(String)</code></a> method as default 
						implementation of <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrapFactory.html"
						><code>LoggerWrapFactory</code></a> interface.
					</li>
					<li><a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrapFactory.html#getLoggerWrap(java.lang.String)"
						><code>LoggerWrapFactory#getLoggerWrap(String)</code></a> method of custom <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrapFactory.html"
						><code>LoggerWrapFactory</code></a> implementation class instance.
					</li>
				</ul>
			</li>
			<li>When your GWT client class has JSNI method to be logged
				<ul>
					<li>If your <b>class does not have static method to be logged</b>, 
						then you <b>may extend <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/client/logging/JsniLoggerWrapAdapterTemplate.html"
						><code>JsniLoggerWrapAdapterTemplate</code></a> abstract class</b>.
					</li>
					<li>When your <b>class has static method to be logged</b>, 
						then refer to <a href="https://code.google.com/p/gwetons/source/browse/trunk/src/main/java/com/newmainsoftech/gwetons/client/RegExpJsniImpl.java"
						><code>RegExpJsniImpl</code></a> class source code as an example.
					</li>
				</ul>
			</li>
		</ul>
		<br />
	</li>
	<li><b>Logger provider side</b> - To configure framework to yield instance of custom
		<code>LoggerWrap</code> implementation<br />
		Change default injector being given by <code>LoggerWrapFactoryInstanceHolder</code> class. <br />
		<code>LoggerWrapFactoryInstanceHolder</code> class holds the default <code>LoggerWrapFactory</code> 
		instance (what is a <code>LoggerWrapFactoryImpl</code> instance). Create <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrapInjector.html"
		><code>LoggerWrapInjector</code></a> implementation class to yield your <code>LoggerWrap</code> 
		implementation instance and set it via <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrapFactoryImpl.html#setLoggerWrapInjector(com.newmainsoftech.gwetons.shared.logging.LoggerWrapInjector)"
		><code>setLoggerWrapInjector(LoggerWrapInjector)</code></a> of that default 
		<code>LoggerWrapFactory</code> instance. <br />
		That makes all objects (logger consumers), what are obtaining logger via either default 
		configuration of <code>LoggerWrapAdapterTemplate</code> or <code>LoggerWrapFactory</code> instance 
		obtained by <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrapFactoryInstanceHolder.html#getLoggerWrapFactory()"
		><code>LoggerWrapFactoryInstanceHolder.getLoggerWrapFactory()</code></a> method, use your custom 
		<code>LoggerWrap</code> implementation.<br />
		So, it is possible to dynamically change the type of logger in multiple logger consumer instances 
		at once.<br />
		<br />
	</li>
	<li>Direct and more granular control way<br />
		Of course, you may use the following ways too.
		<ul>
			<li>Create custom <code>LoggerWrapFactory</code> implementation what yields your custom
				<code>LoggerWrap</code> implementation and set its instance among your logger consumer
				instances.
			</li>
			<li>Create custom <code>LoggerWrap</code> implementation and set its instance directly
				to each of your logger consumer instances.
			</li>
		</ul>
	</li>
</ul>
</p>
<p><h4>Example</h4>
<ul>
	<li>For client-side
		<ul>
			<li>For class without JSNI method
				<ul>
					<li>When extending <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrapAdapterTemplate.html"
						><code>LoggerWrapAdapterTemplate</code></a> abstract class is sufficient enough, see <a href="https://code.google.com/p/gwetons/source/browse/trunk/src/main/java/com/newmainsoftech/gwetons/client/style/css/StyleChangerState.java"
						><code>StyleChangerState</code></a> class source code.
					</li>
					<li>When needs to have static <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/shared/logging/LoggerWrap.html"
						><code>LoggerWrap</code></a> member field, consult with <a href="https://code.google.com/p/gwetons/source/browse/trunk/src/main/java/com/newmainsoftech/gwetons/shared/logging/LoggerWrapAdapterTemplate.java"
						><code>LoggerWrapAdapterTemplate</code></a> abstract class source code to have 
						the idea; basically you need reform those codes to the static visibility. (You may 
						also consult with <a href="https://code.google.com/p/gwetons/source/browse/trunk/src/main/java/com/newmainsoftech/gwetons/client/RegExpJsniImpl.java"
						><code>RegExpJsniImpl</code></a> class source code although it's client side 
						code and using <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/client/logging/JsniLoggerWrap.html"
						><code>JsniLoggerWrap</code></a> class too.)
					</li>
				</ul>  
			</li>
			<li>To log JSNI method in your GWT client code
				<ul>
					<li>If you can extend from <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/client/logging/JsniLoggerWrapAdapterTemplate.html"
						><code>JsniLoggerWrapAdapterTemplate</code></a> abstract class, then see <a href="https://code.google.com/p/gwetons/source/browse/trunk/src/main/java/com/newmainsoftech/gwetons/client/style/css/CssStyleChangerDataUnit.java"
						><code>CssStyleChangerDataUnit</code></a> class source code.
					</li>
					<li>In the situation of not being able to extend from <a href="https://gwetons.googlecode.com/svn/site/apidocs/com/newmainsoftech/gwetons/client/logging/JsniLoggerWrapAdapterTemplate.html"
						><code>JsniLoggerWrapAdapterTemplate</code></a> abstract class (also for using it 
						inside of static JSNI method), see <a href="https://code.google.com/p/gwetons/source/browse/trunk/src/main/java/com/newmainsoftech/gwetons/client/RegExpJsniImpl.java"
						><code>RegExpJsniImpl</code></a> class source code.
					</li>
				</ul> 
			</li>
		</ul>
	</li> 
</ul>
</p>
</body>
</html>